read matlab file in python

42

read matlab file in python -

import scipy.io
mat = scipy.io.loadmat('file.mat')

open mat file in python -

#!python
#!/usr/bin/env python
from scipy.io import loadmat
x = loadmat('test.mat')
lon = x['lon']
lat = x['lat']
# one-liner to read a single variable
lon = loadmat('test.mat')['lon']

Comments

Submit
0 Comments